package com.cmwa.scbp.sys.permission.dataAuthority.entity;

import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.type.Alias;

import com.cmwa.scbp.base.mvc.entity.BaseVo;
import com.cmwa.scbp.base.constants.Constant;
import com.cmwa.scbp.utils.cached.Cached;
import com.cmwa.scbp.utils.cached.DepartmentCached;
import com.cmwa.scbp.utils.cached.DictionaryCached;
import com.cmwa.scbp.utils.cached.EmployeeCached;

/**
 * 角色实体类
 * @author ex-weicb
 * @Date 2016年4月26日 下午5:56:30
 * @Description
 */
@Alias("roleVo")
public class RoleVo extends BaseVo {
	
	/**
	 * 角色ID  编码规则：6位流水号
	 */
	private String roleId;
	
	/**
	 * 角色名称
	 */
	private String roleName;
	
	/**
	 * 角色类型(ROLE_XXX_TYPE)
	 */
	private String roleType;
	
	/**
	 * 状态
	 */
	private String stat;
	
	/**
	 * 权限类型(1:普通,2:特殊)
	 */
	private String authority;
	
	/**
	 * 状态名称
	 */
	@Cached
	private String statName;
	
	/**
	 * 角色类型编码code
	 */
	private String roleTypeCode;
	/**
	 * 权限类型(1:普通,2:特殊)
	 */
	private String authorityType;
	/**
	 * 
	 */
	private String authorityTypeName;
	/**
	 * 操作角色ID
	 */
    private String operRoleId;
    /**
	 * 操作角色名称
	 */
    private String operRoleName;
    /**
	 * 岗位ID
	 */
	private String postId;
	/**
	 * 岗位名称
	 */
	private String postTitle;
	/**
	 * 部门ID
	 */
	private String orgId;
	
	/**
	 * 是否为部门资源默认角色
	 */
	private String isDempt;
	/**
	 * 是否为部门默认角色(中文)
	 */
	private String isDemptName;
	
	/**
	 * 是否为部门人员默认角色
	 */
	private String isDemptPer;
	
	/**
	 * 是否为部门人员默认角色(中文)
	 */
	private String isDemptPerName;
	
	/**
	 * 部门名称
	 */
	private String orgName;
	
	@Cached
	private String empsName;
	
	private String empIds;
	
	private String shareRoleIds;
	
	private String resourceName;
	
	private String emName;
	
	/**
	 * 是否中后台角色
	 */
	private String isMiddleBack;
	
	private String isMiddleBackName;
	
	@Cached
	private String roleTypeName;

	public String getRoleId() {
		return roleId;
	}

	public void setRoleId(String roleId) {
		this.roleId = roleId;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public String getRoleType() {
		return roleType;
	}

	public void setRoleType(String roleType) {
		this.roleType = roleType;
	}

	public String getStat() {
		return stat;
	}

	public void setStat(String stat) {
		this.stat = stat;
	}

	public String getAuthority() {
		return authority;
	}

	public void setAuthority(String authority) {
		this.authority = authority;
	}

	public String getStatName() {
		if (!StringUtils.isEmpty(stat)) {
			return DictionaryCached.getDictName(Constant.DCTTYPE_DAT_CHK_SAT, stat);
		}
		return statName;
	}

	public void setStatName(String statName) {
		this.statName = statName;
	}

	public String getRoleTypeCode() {
		return roleTypeCode;
	}

	public void setRoleTypeCode(String roleTypeCode) {
		this.roleTypeCode = roleTypeCode;
	}

	public String getAuthorityType() {
		return authorityType;
	}

	public void setAuthorityType(String authorityType) {
		this.authorityType = authorityType;
	}

	public String getEmpsName() {
		if (!StringUtils.isEmpty(empIds)) {
			return EmployeeCached.getAllName(empIds);
		}
		return empsName;
	}

	public void setEmpsName(String empsName) {
		this.empsName = empsName;
	}

	public String getEmpIds() {
		return empIds;
	}

	public void setEmpIds(String empIds) {
		this.empIds = empIds;
	}

	public String getShareRoleIds() {
		return shareRoleIds;
	}

	public void setShareRoleIds(String shareRoleIds) {
		this.shareRoleIds = shareRoleIds;
	}

	public String getRoleTypeName() {
		if (!StringUtils.isEmpty(roleType)) {
			return DictionaryCached.getDictName(Constant.DCTTYPE_ROLE_XXX_TYPE, roleType);
		}
		return roleTypeName;
	}

	public void setRoleTypeName(String roleTypeName) {
		this.roleTypeName = roleTypeName;
	}
	
	public String getCreateName() {
		if(!StringUtils.isEmpty(createId)){
			return EmployeeCached.getName(createId);
		}
		return createName;
	}
	public void setCreateName(String createName) {
		this.createName = createName;
	}

	public String getEmName() {
		return emName;
	}

	public void setEmName(String emName) {
		this.emName = emName;
	}

	public String getResourceName() {
		return resourceName;
	}

	public void setResourceName(String resourceName) {
		this.resourceName = resourceName;
	}

	public String getModifyName() {
		if(!StringUtils.isEmpty(modifyId)){
			return EmployeeCached.getName(modifyId);
		}
		return modifyName;
	}
	public void setModifyName(String modifyName) {
		this.modifyName = modifyName;
	}

	public String getOperRoleId() {
		return operRoleId;
	}

	public void setOperRoleId(String operRoleId) {
		this.operRoleId = operRoleId;
	}

	public String getPostId() {
		return postId;
	}

	public void setPostId(String postId) {
		this.postId = postId;
	}

	public String getOrgId() {
		return orgId;
	}

	public void setOrgId(String orgId) {
		this.orgId = orgId;
	}

	public String getOperRoleName() {
		return operRoleName;
	}

	public void setOperRoleName(String operRoleName) {
		this.operRoleName = operRoleName;
	}

	public String getPostTitle() {
		return postTitle;
	}

	public void setPostTitle(String postTitle) {
		this.postTitle = postTitle;
	}

	public String getOrgName() {
		if (org.apache.commons.lang3.StringUtils.isNotBlank(orgId)) {
			return DepartmentCached.getAllName(orgId);
		}
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}

	public String getIsDempt() {
		return isDempt;
	}

	public void setIsDempt(String isDempt) {
		this.isDempt = isDempt;
	}

	public String getIsDemptName() {
		if (Constant.C_STATUS_Y.equals(this.isDempt)) {
			isDemptName = "是";
		}else if (Constant.C_STATUS_N.equals(this.isDempt)) {
			isDemptName = "否";
		}
		return isDemptName;
	}

	public void setIsDemptName(String isDemptName) {
		this.isDemptName = isDemptName;
	}

	public String getAuthorityTypeName() {
		if (Constant.AUTHORITY_TYPE1.equals(this.authorityType)) {
			authorityTypeName = "普通";
		}else {
			authorityTypeName = "特殊";
		}
		return authorityTypeName;
	}

	public void setAuthorityTypeName(String authorityTypeName) {
		this.authorityTypeName = authorityTypeName;
	}

	public String getIsDemptPer() {
		return isDemptPer;
	}

	public void setIsDemptPer(String isDemptPer) {
		this.isDemptPer = isDemptPer;
	}

	public String getIsDemptPerName() {
		if (Constant.C_STATUS_Y.equals(this.isDemptPer)) {
			isDemptPerName = "是";
		}else if (Constant.C_STATUS_N.equals(this.isDemptPer)) {
			isDemptPerName = "否";
		}
		return isDemptPerName;
	}

	public void setIsDemptPerName(String isDemptPerName) {
		this.isDemptPerName = isDemptPerName;
	}
	
	public String getIsMiddleBack() {
		return isMiddleBack;
	}

	public void setIsMiddleBack(String isMiddleBack) {
		this.isMiddleBack = isMiddleBack;
	}

	public String getIsMiddleBackName() {
		if (StringUtils.isNotBlank(isMiddleBack)) {
			return DictionaryCached.getDictName("DAT_YES_NOX", isMiddleBack);
		}
		return isMiddleBackName;
	}

	public void setIsMiddleBackName(String isMiddleBackName) {
		this.isMiddleBackName = isMiddleBackName;
	}
}
